package com.example.lin.day9_14_passwordview;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.tuo.customview.VerificationCodeView;

public class MainActivity extends AppCompatActivity {


    private static final String TAG = MainActivity.class.getSimpleName();
    private VerificationCodeView codeView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        codeView = findViewById(R.id.icv);
        codeView.setPwdMode(false);

        codeView.setInputCompleteListener(new VerificationCodeView.InputCompleteListener() {

            @Override
            public void inputComplete() {
                String inputContent = codeView.getInputContent();
                Log.d(TAG, "inputComplete: " + inputContent);
                if ("678521".equals(inputContent)) {
                    Toast.makeText(MainActivity.this, "验证码输入成功!", Toast.LENGTH_SHORT).show();
                    finish();
                }
            }

            @Override
            public void deleteContent() {
                String inputContent = codeView.getInputContent();
                Log.w(TAG, "deleteContent: " + inputContent);

            }
        });

    }


}
